/*
 * @Author: 何善万 swhe@che300.com
 * @Date: 2024-08-16 14:32:34
 * @LastEditors: 何善万 swhe@che300.com
 * @LastEditTime: 2024-08-20 16:17:07
 * @FilePath: \my-notion-redux\src\redux\store.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

// src/redux/store.js
import { configureStore, createReducer } from '@reduxjs/toolkit';
import { useDispatch } from 'react-redux';
import IndexListReducer from './slices';
import logger from 'redux-logger';

const store = configureStore({
  reducer: {
    ...IndexListReducer
  },
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: {
        ignoredActions: ['commonFunsSlice/setCommonFunc'],
        // ignoredActionPaths: ['global.navigate'],
        ignoredPaths: ['commonFun.setThemeColor', 'commonFun.setThemeColor', 'commonFun.changeLanguage', 'commonFun.navigate', 'job.sectionDomArr']
      }
    }).concat(logger),

  devTools: process.env.NODE_ENV !== 'production'
  // preloadedState,
  // enhancers: (getDefaultEnhancers) =>
  //   getDefaultEnhancers({
  //     autoBatch: false,
  //   }).concat(batchedSubscribe(debounceNotify)), //增强器
});

export const useAppDispatch = () => useDispatch();

export default store;
